<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录 - 校园失物招领系统</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(135deg, #3498db, #2980b9);
            background-size: cover;
            background-position: center;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Nunito', sans-serif;
        }
        
        .login-container {
            width: 100%;
            max-width: 420px;
            padding: 15px;
        }
        
        .login-card {
            background-color: rgba(255, 255, 255, 0.95);
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
        }
        
        .login-header {
            background-color: #3498db;
            color: white;
            padding: 20px;
            text-align: center;
        }
        
        .login-body {
            padding: 30px;
        }
        
        .form-control {
            border-radius: 5px;
            padding: 10px 15px;
            height: auto;
            margin-bottom: 15px;
        }
        
        .btn-login {
            background-color: #3498db;
            border: none;
            border-radius: 5px;
            padding: 10px;
            font-weight: 600;
            width: 100%;
        }
        
        .btn-login:hover {
            background-color: #2980b9;
        }
        
        .login-footer {
            text-align: center;
            margin-top: 20px;
        }
        
        .login-footer a {
            color: #3498db;
            text-decoration: none;
        }
        
        .login-footer a:hover {
            text-decoration: underline;
        }
        
        .alert {
            border-radius: 5px;
        }
        
        .form-select {
            border-radius: 5px;
            padding: 10px 15px;
            height: auto;
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-card">
            <div class="login-header">
                <h3 class="m-0">失物招领系统</h3>
                <p class="m-0">用户登录</p>
            </div>
            <div class="login-body">
                <!-- 错误消息 -->
                <div th:if="${param.error}" class="alert alert-danger mb-4">
                    <i class="fas fa-exclamation-circle me-2"></i>
                    用户名或密码错误，请重试
                </div>
                
                <!-- 登出消息 -->
                <div th:if="${param.logout}" class="alert alert-success mb-4">
                    <i class="fas fa-check-circle me-2"></i>
                    您已成功退出登录，请重新登录以继续使用系统
                </div>
                
                <!-- 其他消息 -->
                <div th:if="${successMessage}" class="alert alert-success mb-4">
                    <i class="fas fa-check-circle me-2"></i>
                    <span th:text="${successMessage}"></span>
                </div>
                
                <div th:if="${errorMessage}" class="alert alert-danger mb-4">
                    <i class="fas fa-exclamation-circle me-2"></i>
                    <span th:text="${errorMessage}"></span>
                </div>
                
                <!-- 登录表单 -->
                <form th:action="@{/login}" method="post">
                    <div class="mb-3">
                        <label for="username" class="form-label">用户名:</label>
                        <input type="text" id="username" name="username" class="form-control" placeholder="请输入用户名" required autofocus>
                    </div>
                    
                    <div class="mb-3">
                        <label for="password" class="form-label">密码:</label>
                        <input type="password" id="password" name="password" class="form-control" placeholder="请输入密码" required>
                    </div>
                    
                    <!-- 角色选择只是显示用，不需要提交到后端 -->
                    <div class="mb-3">
                        <label for="role" class="form-label">角色:</label>
                        <select id="role" class="form-select">
                            <option value="USER" selected>用户</option>
                            <option value="ADMIN">管理员</option>
                        </select>
                    </div>
                    
                    <div class="mb-3 form-check">
                        <input type="checkbox" class="form-check-input" id="remember-me" name="remember-me">
                        <label class="form-check-label" for="remember-me">记住我</label>
                    </div>
                    
                    <button type="submit" class="btn btn-primary btn-login">登 录</button>
                </form>
            </div>
            
            <div class="login-footer">
                <p>还没有账号？<a th:href="@{/register}">立即注册</a></p>
                <p><a th:href="@{/}">返回首页</a></p>
            </div>
        </div>
    </div>
    
    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html> 